package com.jmp.base.dto;

import lombok.Builder;
import lombok.Data;

import java.util.Date;
import java.util.List;

@Data
@Builder
public class LiveInfoResponse {
    private boolean hasRoom;
    private Integer roomId;
    private Integer videoType;
    private Integer liveStatus;
    private Integer cardId;
    private String name;
    private String photo;
    private Integer userCurrentRoomId;

    private Integer preFlag;
    private Date preTime;

    private String videoUrl;
    private String screenshotUrl;

    private String pushUrl;
    private String pullUrl;
    private String groupId;
    private Integer viewerNum;
    private List<String> viewerPhotos;

    public boolean isPre() {
        return isHasRoom() && getLiveStatus() == 0 && getPreFlag() == 1;
    }

    public boolean isOn() {
        return isHasRoom() && getLiveStatus() == 1;
    }

    public boolean isReview() {
        return isHasRoom() && getLiveStatus() == 2;
    }

    public long countRemainingTime() {
        long remainingTime = getPreTime().getTime() - (new Date()).getTime();
        return  remainingTime > 0 ? remainingTime : 0;
    }
}
